class Solution {
    public int[] searchRange(int[] nums, int target) {
        if(nums == null || nums.length == 0) return new int[]{-1,-1};
        int[] cre = new int[]{-1,-1};
        int q = 0;
        for(int i = 0;i < nums.length;i++) {
            if(nums[i] > target) break;
            if(nums[i] == target) {
                if(q == 0) {
                    cre[0] = i;
                    q = 1;
                } else {
                    cre[1] = i;
                }
            }
        }
        if(cre[0] == -1) return new int[]{-1,-1};
        if(cre[1] == -1) {
            cre[1] = cre[0];
            return cre;
        } 
        return cre;
    }
}